import sys, time
import picklewrapper as pw

FNAME = 'temp.dat'

class FOO(object):
    def __init__(self, ii):
        self.yy = ii

class Tester(object):
    def lay1(self):
        x = 11
        y = 22
        pw.save(FNAME,'x','y')
        
    def lay2(self):
        x = 33
        y = 44
        self.lay1()    


#-- EXAMPLE 1 --#
x = 1
y = "MAX!!!"
foofoo = FOO(123)
tt = range(1,1000)
pw.save(FNAME,'x', 'y', 'foofoo', 'tt')
del x,y,foofoo,tt
pw.load(FNAME)
assert(x==1 and y=="MAX!!!" and foofoo.yy ==123 and tt==range(1,1000))

#--Example 2 --#
t = Tester()
t.lay2()
pw.load(FNAME)
assert(x == 11 and y == 22)
